# -*- coding: utf-8 -*-
"""
Created on Sat Jul 31 15:41:24 2021

@author: A3162
"""
import os
import xlrd

path = 'D:/Documents/工作/疫情数据/通管局数据/20211231/'
file = os.listdir(path)
print(file)
SKBS = 0
ZDQY = 0
SM = 0

for i in file:
    # print(path + i)
    file_name, suff = os.path.splitext(i)
    if suff == '.xlsx':
        data = xlrd.open_workbook(path + i)
        sum1 = 0
        table = data.sheet_by_index(0)
        for j in range(1, 1000000):
            try:
                table.cell_value(j, 0)
                sum1 = sum1 + 1
            except Exception as e:
                print(e)
        #print(i)
        print(i + '数据条数:' + str(sum1))
        if 'SKBS' in i:
            SKBS = SKBS + sum1
        if 'ZDQY' in i:
            ZDQY = ZDQY + sum1
        if 'SM' in i:
            SM = SM + sum1
print('SKBS:' + str(SKBS))
print('ZDQY:' + str(ZDQY))
print('SM:' + str(SM))
